﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameServer.Networking.Packets;

namespace GameServer.Networking.Handlers
{
    class HANDLE_ROOM_LEAVE : PacketHandler
    {
        public override void Handle(GameServer.Virtual_Objects.User.virtualUser User)
        {
            try
            {
                if (User.isSpectating)
                {
                    User.Room.removeSpectator(User);
                    return;
                }
                if (User.Room != null)
                    User.Room.removeUser(User.RoomSlot);
                User.send(new Packets.PACKET_ROOM_LIST(User, User.Page));
            }
            catch (Exception ex)
            {
                Log.WriteError(ex.Message);
            }
        }
    }
}
